Repository navigation
fix(desktop): log the window's web process to webview.log - #4253
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On macOS, WebKit draws the window in its own process (
com.apple.WebKit.WebContent, which Activity Monitor lists astauri://localhost). launchd starts that process, not the app, so it is not listed under RustCode. A user saw it at about 1 GB, with the MacBook getting hot, and quit it. The window went blank, the page loaded again, and the engine restarted. None of this was recorded anywhere.This adds
webview.login the config folder (same rolling format asupdates.log, 400 lines):webview.process: the web process's pid, memory (physical footprint) and CPU time when it is first seenwebview.process_replaced: the old and new pid, plus the old process's last and peak memorywebview.memory: each crossing of 1/2/4/8 GB, once per processwebview.busy: over 50% of a core for a whole minute (at the start, then every 10 min while it lasts)webview.sample: an hourly summarywebview.reloaded: the page loaded again and the engine restarted for it (engine.rs)It samples once a minute with
_webProcessIdentifier(selector checked first) andproc_pid_rusage. It runs only on macOS; on other platforms it does nothing.Changelog
The desktop app records the window's web process memory, CPU and restarts in
webview.log, so a hot or bloated window leaves evidence.Testing
cargo clippy --all-targets -D warningsandcargo fmt --checkinapps/desktop/src-tauri. The decision logic has unit tests (CI). Checked therusage_info_v0layout against the running web process: it reads a 289 MB footprint, which matchesfootprint.